---
title: "Channels"
description: "Channels let you manage updates across different environments (development, staging, production) and target specific user groups or separate applications."
icon: Radio
---

import { Tabs, Tab } from 'fumadocs-ui/components/tabs';

## Overview

Channels work for both environment management and multi-app scenarios. You can use them to separate environments like dev, staging, and production, or to manage completely different apps (e.g., app2, app3, app4) with their own channels.

- **Default Channel**: Apps use the `production` channel when no channel is specified.
- **Environment Management**: Separate your environments (`dev`, `staging`, `production`) to control which updates go where.

## Setting Up Channels

### 1. Specify Channel in Configuration File

<Tabs items={['Basic', 'Expo']}>
  <Tab value="Basic">
    Use the `hot-updater channel set` command to specify your desired channel.

    ```package-install
    npx hot-updater channel set <channel>
    ```

    This command will modify the native project files for you. Here's what changes:

    <Tabs items={['iOS', 'Android']}>
      <Tab value="iOS">
      ```tsx title="ios/HotUpdaterExample/Info.plist"
      <key>HOT_UPDATER_CHANNEL</key> // [!code ++]
      <string>your_set_channel</string> // [!code ++]
      ```
      </Tab>

      <Tab value="Android">
      ```xml title="android/app/src/main/res/values/strings.xml"
      <resources>
          <string name="app_name">HotUpdaterExample</string>
           // [!code ++]
          <string name="hot_updater_channel" moduleConfig="true">your_set_channel</string>
      </resources>
      ```
      </Tab>
    </Tabs>
  </Tab>
  <Tab value="Expo">
    For Expo, you need to add the channel to the plugin configuration in your `app.json` file.

    ```json title="app.json"
    {
      "expo": {
        "plugins": [
          [
            "@hot-updater/react-native",
            {
              "channel": "<your-channel-name>"
            }
          ]
        ]
      }
    }
    ```
    Replace `<your-channel-name>` with your desired channel (e.g., `production`).

    After modifying `app.json`, run `prebuild` to apply the changes to the native projects.

    ```package-install
    npx expo prebuild --clean
    ```
  </Tab>
</Tabs>

## Custom Configuration Paths

For projects with non-standard structures or iOS app extensions, you can configure custom paths for platform-specific configuration files in your `hot-updater.config.ts`:

```typescript title="hot-updater.config.ts"
import { defineConfig } from "hot-updater";

export default defineConfig({
  // ... other configurations
  platform: {
    ios: {
      infoPlistPaths: [
        "ios/YourApp/Info.plist",
        "ios/YourAppExtension/Info.plist", // Include extension Info.plist
        "ios/NotificationService/Info.plist"
      ]
    },
    android: {
      stringResourcePaths: [
        "android/app/src/main/res/values/strings.xml",
        "android/app/src/debug/res/values/strings.xml" // Include additional resource files
      ]
    }
  }
});
```

This is useful when:
- Your iOS project has app extensions (widgets, share extensions, notification services)
- You have multiple Android build variants with different resource paths
- Your project doesn't follow the standard React Native file structure

**Important**: Configure these custom paths before running `hot-updater channel set` commands to ensure all relevant files are updated with the new channel.

### 2. Rebuild App with New Channel

After setting the channel, rebuild your app in Release mode:

<Tabs items={['Bare (React Native CLI)', 'Rock', 'Expo']}>
  <Tab value="Bare (React Native CLI)">
    **iOS:**
    ```sh
    cd ios && pod install && cd ..
    npx react-native run-ios --mode Release
    ```

    **Android:**
    ```sh
    npx react-native run-android --mode Release
    ```
  </Tab>
  <Tab value="Rock">
    **iOS:**
    ```sh
    npx rock run:ios --configuration Release
    ```

    **Android:**
    ```sh
    npx rock run:android --variant Release
    ```
  </Tab>
  <Tab value="Expo">
    **iOS:**
    ```sh
    npx expo run:ios --variant release
    ```

    **Android:**
    ```sh
    npx expo run:android --variant release
    ```
  </Tab>
</Tabs>

### 3. Specify Channel Deployment

You can also specify the target channel directly during deployment:

```package-install
npx hot-updater deploy -p <"ios" | "android"> -c "<channel>"
```

Replace `<channel>` with your target channel name (e.g., `dev`, `staging`, `production`).

## Retrieving the Current Channel

Use the `HotUpdater.getChannel()` function to retrieve the current release channel within your app.
We recommend displaying this value in your app UI to visually confirm that it's using the intended update channel.

### Example Usage

```tsx
import { HotUpdater } from "@hot-updater/react-native";
import { Text, View } from "react-native";

function App() {
  const channel = HotUpdater.getChannel();

  return (
    <View>
      <Text>Current Channel: {channel}</Text>
    </View>
  );
}

export default HotUpdater.wrap({
  baseURL: "<your-update-server-url>",
  updateStrategy: "appVersion", // or "fingerprint"
  updateMode: "auto",
})(App);
```

## Channel Behavior

- Defaults to `production` if no channel is specified.
- Channels ensure separation of different environments (e.g., `dev`, `staging`, `production`) to apply updates accurately.
- Updates can subsequently be deployed using `hot-updater deploy -c <channel>`.
- **Important**: Changing the channel requires rebuilding the native app; simply altering the configuration file or deployment commands will not affect an already built app.
